package com.example.xuehu.getweather;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //https://git.oschina.net/huxue/getWeather.git//
    }

    public void getPro(View view) {
        new Thread(){
            @Override
            public void run() {
                try {
                    String url = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl";
                    String name = "http://WebXml.com.cn";
                    String action = "getRegionProvince";
                    HttpTransportSE se = new HttpTransportSE(url);

                    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                    SoapObject soap = new SoapObject(name,action);
                    envelope.setOutputSoapObject(soap);
                    envelope.dotNet=true;

                    se.call(name+"/"+action,envelope);
                    SoapObject object = (SoapObject)envelope.getResponse();
                    for(int i=0;i<object.getPropertyCount();i++){
                        Log.i("jack",object.getProperty(i).toString());
                    }

                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }.start();
    }
}
